<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');

/**
 * Copyright (c) 2010, must art
 *All rights reserved.
 *
 *Redistribution and use in source and binary forms, with or without
 *modification, are permitted provided that the following conditions are met:
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *    * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *    * Neither the name of the <organization> nor the
 *      names of its contributors may be used to endorse or promote products
 *      derived from this software without specific prior written permission.
 *
 *THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 *ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 *WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *DISCLAIMED. IN NO EVENT SHALL must art BE LIABLE FOR ANY
 *DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 *(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 *LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * PHP version 5
 * @copyright  must art 2010
 * @author     Jan Philipp Pietrzyk <programming@must-art.de>
 * @package    
 * @license    BSD
 * @filesource
 */
$GLOBALS['TL_DCA']['tl_mayac_videos'] = array
(
	// Config
	'config' => array
	(
		'dataContainer'               => 'Table',
		'doNotCopyRecords'            => true,
		'enableVersioning'            => false,
		'onload_callback'			  => array
		(
											array('BackendMAYoutubeApiConnector', 'initUpdate')
		),
		'ondelete_callback' 		  => array
		(
											array('BackendMAYoutubeApiConnector', 'deleteByDc')
		),
		'onsubmit_callback'			  => array
		(
											array('BackendMAYoutubeApiConnector', 'submit')
		)

	),

	// List
	'list' => array
	(
		'sorting' => array
		(
			'mode'                    => 1,
			'fields'                  => array('title'),
			'flag'                    => 1,
			'panelLayout'             => 'filter;search,limit'
		),
		'label' => array
		(
			'fields'                  => array('title', 'tags', 'ytId'),
			'format'                  => '<strong>%s</strong>, %s, <a target="_blank" href="http://www.youtube.com/watch?v=%s">ansehen</a>',
			'label_callback'          => array('BackendMAYoutubeApiConnector', 'listView')
		),
		'global_operations' => array
		(
			/*
			'all' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
				'href'                => 'act=select',
				'class'               => 'header_edit_all',
				'attributes'          => 'onclick="Backend.getScrollOffset();"'
			)
			*/
		),
		'operations' => array
		(
			'edit' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_mayac_videos']['edit'],
				'href'                => 'act=edit',
				'icon'                => 'edit.gif'

			),
			'delete' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_mayac_videos']['delete'],
				'href'                => 'act=deny',
				'icon'                => 'delete.gif',
				'attributes'          => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
			),
			'toggle' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_mayac_videos']['toggle'],
				'icon'                => 'visible.gif',
				'href'				  => 'act=aprove',
				'attributes'          => 'onclick="Backend.getScrollOffset();"',
				'button_callback'     => array('BackendMAYoutubeApiConnector', 'toggleIcon')
			),
			'show' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_mayac_videos']['show'],
				'href'                => 'act=show',
				'icon'                => 'show.gif'
			)
		)
	),

	// Palettes
	'palettes' => array
	(
		'default'                     => '{title_legend},title,tags,category,description,private;{video_legend},video'
	),

	// Fields
	'fields' => array
	(
		'title' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_mayac_videos']['title'],
			'exclude'                 => true,
			'search'                  => true,
			'inputType'               => 'text',
			'eval'                    => array('mandatory'=>true, 'maxlength'=>64)
		),
		'tags' => array(
			'label'					  => &$GLOBALS['TL_LANG']['tl_mayac_videos']['tags'],
			'exclude'				  => true,
			'search'				  => true,
			'inputType'				  => 'listWizard',
			'eval'					  => array('mandatory'=> true, 'maxlength' => 256)
		),
		'category' => array(
					//'name' => 'mayt_category',
					'label' => $GLOBALS['TL_LANG']['tl_mayax_videos']['category'],
					'inputType' => 'select',
					'options_callback' => array('BackendMAYoutubeApiConnector', 'getGlobalCategories'),
					'eval' => array('mandatory'=>true, )
			
		),
		'description' => array(
					//'name' => 'mayt_description',
					'label' => $GLOBALS['TL_LANG']['tl_mayac_videos']['description'],
					'inputType' => 'textarea',
					'eval' => array('mandatory'=>true)
			
		),
		'private' => array(
					'label' => $GLOBALS['TL_LANG']['tl_mayac_videos']['private'],
					'inputType' => 'checkbox',
					'eval' => array()
		),
		'video' => array(
			'input_field_callback' => array('BackendMAYoutubeApiConnector', 'videoCallback')
		)
	)
);

?>